package com.zerox.mapper;

import com.zerox.pojo.Supplier;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SupplierMapper {
    @Select("  select * from t_supplier where supContact like concat('%',#{supContact},'%') limit #{page},#{limit}")
    List<Supplier> getList(@Param("supContact") String supContact, @Param("page")Integer page, @Param("limit")Integer limit);
    @Select("select count(*) from t_supplier where supContact like concat('%',#{supContact},'%') ")
    Integer count(@Param("supContact")String supContact);
    
    @Insert("INSERT INTO `t_supplier`( `supCode`, `supName`, `supDesc`, `supContact`, `supPhone`, `supAddress`, `supFax`, `createdUserId`,`createdTime`) VALUES (#{supCode},#{supName},#{supDesc},#{supContact},#{supPhone},#{supAddress},#{supFax},#{createdUserId},now())")
    int add(Supplier supplier);
    
    @Select("select * from t_supplier where id=#{id}")
    Supplier selectById(Integer id);
    
    @Delete("delete from t_supplier where id=#{id}")
    int delete(Integer id);
    
    Integer update(Supplier supplier);
}
